package tests;

import junit.framework.Assert;
import model.EnhancedCostEvaluator;
import model.Problem;
import model.Solution;

import org.junit.Test;

import util.Importer;
import util.SolutionImporter;

public class SolutionImporterTest {
	@Test
	public void readData() {
		Importer importer = new Importer("datasets//model_example.txt");
		Problem problem = importer.getProblem();
		importer.readData();
		Assert.assertEquals(4, problem.getMachines().size());
		Assert.assertEquals(2, problem.getResources().size());
		SolutionImporter solutionImporter = new SolutionImporter(problem);
		solutionImporter
				.setSolutionFileName("solutions//initial_solution_example.txt");
		solutionImporter.readData();
		Solution solution1 = solutionImporter.getSolution();
		solutionImporter
				.setSolutionFileName("solutions//new_solution_example.txt");
		solutionImporter.readData();
		Solution solution2 = solutionImporter.getSolution();
		EnhancedCostEvaluator ece = new EnhancedCostEvaluator();
		ece.setSolutionPair(solution1, solution2);
		Assert.assertEquals(true, ece.isFeasible());
	}
}
